<template>
  <div>
    <el-form class="input-form"
             label-position="right"
             label-width="120px"
             ref="editForm"
             :rules="propRules"
             :model="form"
    >
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="版本库" prop="versionLib">
            {{utils.getDictLabel(form.versionLib, 'svn_version',null, false)}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="版本号" prop="versionNum">
            {{form.versionNum}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="提交人" prop="submitUser">
            {{form.submitUser}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="提交日期" prop="submitDate">
            {{form.submitDate}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="版本库地址" prop="versionUrl">
            {{form.versionUrl}}
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="子系统" prop="changeSystem">
            {{utils.getDictLabel(form.changeSystem, 'svn_system',null, false)}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="功能分类" prop="changeType">
            {{form.changeType}}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="需求来源链接" prop="changeUrl">
            <div   style="font-size: 13px;line-height: 20px;max-height: 200px ; overflow: auto">
              <div v-for="(url,index) in split(form.changeUrl)" :key="index">
                <el-button    @click="openWinOut(url)" size="mini" round
                              :title="'点击访问'"
                >{{url}}</el-button>
              </div>
            </div>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="需求来源" prop="changeFrom">
            {{form.changeFrom}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="需求来源标识" prop="changeCode">
            {{form.changeCode}}
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="影响文件数量" prop="fileNum">
            {{form.fileNum}}
          </el-form-item>
        </el-col>

      </el-row>

      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="影响菜单" prop="changeMenu">
            <div   v-for="(menu,index) in split(form.changeMenu)"  :key="index">
              {{menu}}
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item label="影响文件列表" prop="fileList">
            <pre style="font-size: 13px;line-height: 20px;max-height: 200px ; overflow: auto">{{form.fileList}}</pre>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="修改描述" prop="changeRemark">
            <pre style="font-size: 13px;line-height: 20px;">{{form.changeRemark}}</pre>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="提交原始日志" prop="submitRemark">
            <pre style="font-size: 13px;line-height: 20px;">{{form.submitRemark}}</pre>
          </el-form-item>
        </el-col>
      </el-row>

    </el-form>
  </div>
</template>

<script>
/*eslint-disable*/
export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  methods: {
    //新tab打开链接
    openWinOut(url) {
      window.open(url, "_blank");
    },

    //新tab打开链接
    split(str) {
      if (this.strings.isBlank(str)) return []
      return str.split(',')
    },
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)

        // 设置switch 元素默认值
      },
      afterSave: () => {  },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      }
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object
  },
  components: {
  },
  computed: {
  }
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
  }
</style>
